home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / Convert_VB339301182001.psc / ODL Converter / Classes / SCLanguage.cls < prev    next >
Encoding:
Visual Basic class definition  |  2001-11-07  |  3.6 KB  |  129 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4.   Persistable = 0  'NotPersistable
  5.   DataBindingBehavior = 0  'vbNone
  6.   DataSourceBehavior  = 0  'vbNone
  7.   MTSTransactionMode  = 0  'NotAnMTSObject
  8. END
  9. Attribute VB_Name = "SCLanguage"
  10. Attribute VB_GlobalNameSpace = False
  11. Attribute VB_Creatable = False
  12. Attribute VB_PredeclaredId = False
  13. Attribute VB_Exposed = False
  14. Option Explicit
  15. Private r_strName As String
  16. Private r_sleEngine As SCLangEngine
  17. Private r_gosOperatorList As Operators
  18. Private r_gksKeywordList As Keywords
  19. Private r_clsCollection As SCLanguages
  20.  
  21. Public Property Get Collection() As SCLanguages
  22.     Set Collection = r_clsCollection
  23. End Property
  24.  
  25. Public Property Set Collection(ByVal v_clsCollection As SCLanguages)
  26.     Set r_clsCollection = v_clsCollection
  27. End Property
  28.  
  29. Friend Property Get OperatorList() As Operators
  30.     OperatorList = r_gosOperatorList
  31. End Property
  32.  
  33. Friend Property Let OperatorList(v_gosOperatorList As Operators)
  34.     r_gosOperatorList = v_gosOperatorList
  35. End Property
  36.  
  37. Public Property Get Name() As String
  38.     Name = r_strName
  39. End Property
  40.  
  41. Public Property Let Name(ByVal v_strName As String)
  42.     r_strName = v_strName
  43. End Property
  44.  
  45. Public Property Get Engine() As SCLangEngine
  46.     Set Engine = r_sleEngine
  47. End Property
  48.  
  49. Public Property Set Engine(ByVal v_sleSCLangEngine As SCLangEngine)
  50.     If r_sleEngine Is v_sleSCLangEngine Then _
  51.         Exit Property
  52.     If Not r_sleEngine Is Nothing Then
  53.         If r_sleEngine.Language Is Me Then
  54.             Set r_sleEngine = Nothing
  55.         End If
  56.     End If
  57.     Set r_sleEngine = v_sleSCLangEngine
  58.     If Not v_sleSCLangEngine Is Nothing Then
  59.         Set v_sleSCLangEngine.Language = Me
  60.     End If
  61. End Property
  62.  
  63. Private Sub Class_Initialize()
  64.     Set r_sleEngine = New SCLangEngine
  65.     Set r_sleEngine.Language = Me
  66. End Sub
  67.  
  68. Friend Property Get KeywordList() As Keywords
  69.     KeywordList = r_gksKeywordList
  70. End Property
  71.  
  72. Friend Property Let KeywordList(v_gksKeywordList As Keywords)
  73.     r_gksKeywordList = v_gksKeywordList
  74. End Property
  75.  
  76. Public Sub AddKeyWord(ByVal Description As String, ByVal TokenValue As String, Optional ByVal Flags As KeywordFlags = G_KF_Flexable)
  77.     With r_gksKeywordList
  78.         If .Count = 0 Then
  79.             ReDim .Keywords(1 To .Count + 1)
  80.         Else
  81.             ReDim Preserve .Keywords(1 To .Count + 1)
  82.         End If
  83.         .Count = .Count + 1
  84.         With .Keywords(.Count)
  85.             .Description = Description
  86.             .StringValue = TokenValue
  87.             .Flags = Flags
  88.         End With
  89.     End With
  90. End Sub
  91.  
  92. Public Sub AddOperator(ByVal Description As String, ByVal TokenValue As String, Optional Priority As Long = 1)
  93.     With r_gosOperatorList
  94.         If .Count = 0 Then
  95.             ReDim .Operators(1 To .Count + 1)
  96.         Else
  97.             ReDim Preserve .Operators(1 To .Count + 1)
  98.         End If
  99.         .Count = .Count + 1
  100.         With .Operators(.Count)
  101.             .Value = TokenValue
  102.             .Priority = Priority
  103.             .Description = Description
  104.         End With
  105.     End With
  106. End Sub
  107.  
  108. Public Sub RemoveKeyword(ByVal Index As Long)
  109.     With r_gksKeywordList
  110.         Do Until Index >= .Count - 1
  111.             .Keywords(Index) = .Keywords(Index + 1)
  112.             Index = Index + 1
  113.         Loop
  114.         ReDim .Keywords(1 To .Count)
  115.     End With
  116. End Sub
  117.  
  118. Friend Sub AddToken(Token As LexicalToken, Tokens As LexicalTokens)
  119.     With Tokens
  120.         If .Count = 0 Then
  121.             ReDim .Tokens(1 To .Count + 1)
  122.         Else
  123.             ReDim Preserve .Tokens(1 To .Count + 1)
  124.         End If
  125.         .Count = .Count + 1
  126.         .Tokens(.Count) = Token
  127.     End With
  128. End Sub
  129.